package rule_window

import (
	"file_explorer/model"

	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func (window *RuleWindow) newRuleExtNameTab(onSubmit func()) *container.TabItem {
	form := widget.NewForm()

	extNameEntry := widget.NewEntry()

	form.Append("扩展名", extNameEntry)
	form.OnSubmit = func() {
		window.tabCtx.Rules = append(window.tabCtx.Rules, model.NewExtNameRule(extNameEntry.Text))
		onSubmit()
	}

	return container.NewTabItem("扩展名", form)
}
